import React, {Component} from 'react';
// import { connect } from 'dva';
import { List , NavBar } from 'antd-mobile';
import Footer from '../components/Footer';

const Item = List.Item;
const Brief = Item.Brief;

class Searchresult extends Component {
  constructor(props) {
    super(props)
    this.state = {
      classlist:[
        {
          name:'python入门三十天课程',
          brief:'python学习适合高中生的最佳选择',
          gotosrc:NaN
        },
        {
          name:'JAVA入门三十天课程',
          brief:'JAVA入门由此处一路向前',
          gotosrc:NaN
        }
      ],
      professorlist:[
        {
          name:'李白',
          photosrc:'../assets/profbrief.jpeg',
          brief:'清华大学终身名誉教授',
          engbrief:'Honor Professor of Tsinghua University',
          gotosrc:NaN
        }
      ],
      articlelist:[
        {
          name:'为什么我们鼓励学习python？',
          author:'卓异教育',
          gotosrc:NaN
        }
      ]
    }
  }
  // componentWillMount(){  初始化时调取数据
  //   dispatch({
  //     type:'search/..',
  //     text:searchtext
  //   })
  // }
  render(){
    let classlist = this.state.classlist.map((item) => (
          <Item multipleLine arrow="horizontal">
            {item.name} <Brief>{item.brief}</Brief>
          </Item>
        ))
    let proflist = this.state.professorlist.map((item) => (
          <Item  arrow="horizontal" thumb={require('../assets/profbrief.jpeg')}>
            {item.name}
            <Brief>{item.brief}</Brief>
            <Brief>{item.engbrief}</Brief>
          </Item>
        ))
    let articlelist = this.state.articlelist.map((item) => (
          <Item  arrow="horizontal" >
            {item.name}
            <Brief>作者：{item.author}</Brief>
          </Item>
        ))
    return(
      <div>
        <NavBar
        mode="dark"
        leftContent="返回"
        onLeftClick={() => console.log('back')}
      >搜索结果</NavBar>
        <List renderHeader={() => '课程'} className="">
          {classlist}
        </List>
        <List renderHeader={() => '授课老师'} className="">
          {proflist}
        </List>
        <List renderHeader={() => '文章'} className="">
          {articlelist}
        </List>
        <Footer/>
      </div>
    )
  }
}
Searchresult.propTypes = {

};

export default Searchresult;
